-
-
Notifications
You must be signed in to change notification settings - Fork 90
feat(ai): inference API #501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kallebysantos
wants to merge
8
commits into
supabase:develop
Choose a base branch
from
kallebysantos:feat-ort-inference-api
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat(ai): inference API #501
kallebysantos
wants to merge
8
commits into
supabase:develop
from
kallebysantos:feat-ort-inference-api
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86bff1c
to
d0e9461
Compare
2 tasks
🔕 This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
bot reply |
- Exposing an user friendly interface to consume the `onnx` backend
- using `InferenceAPI` to perform `text-to-audio`. - encoding `wave` audio tensors from the rust land
Documenting the "magic numbers" of the `text-to-audio` exmaple, [original paper](https://arxiv.org/pdf/2306.07691)
- Adding `fromStorage` method to InferenceAPI, its allows model loadingfrom Supabase Storage with public/private bucket support.
d0e9461
to
f21cd9d
Compare
f21cd9d
to
bbcda7a
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
feature
What is the current behavior?
Since PR #436, is possible to use
onnx
inference by calling theglobalThis[Symbol.for('onnxruntime')]
What is the new behavior?
Coming from Issue #479, the Inference API is an user friendly interface that allows developers easily run their own models using the power of the low level
onnx rust backend
.It's based on two core componenents
RawSession
andRawTensor
RawSession
: A low levelSupabase.ai.Session
that can execute any.onnx
model. It's recommended for use cases where need more control of the pre/pos-processing steps like text-to-audio example, as well when need to executelinear regression
,tabular classification
and self-made models.RawTensor
: A low level data representation of the model input/output. Inference API's Tensors are fully compatible with Transformers.js Tensors. It means that developers can still be using the high-lavel abstractions thattransformers.js
provides, like:.sum()
,.normalize()
,.min()
.Examples:
Simple utilization:
Loading a
RawSession
:Executing a
RawSession
withRawTensor
:Generating embeddings from scratch:
This example demonstrates how Inference API can be used to complex scenarios while taking advantage of Transformers.js high-level functions
Self-made models
This example ilustrate how users can train their own model and execute it direclty from
edge-runtime
The model was trained to expect the following object payload
Then the model inference can done inside a common
Edge Function
TODO:
tryEncodeAudio()
, check out the text-to-audio exampleTensor Image support, forimage generation